* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f8f9fa;
  min-height: 100vh;
}

/* 头部背景和布局 */
header {
  position: relative;
  background: linear-gradient(135deg, #2E5939 0%, #4CAF50 50%, #2E5939 100%);
  color: white;
  overflow: hidden;
  height: 280px;
}

.header-content {
  position: relative;
  z-index: 2;
  width: 1200px;
  margin: 0 auto;
  padding: 0 1.5em;
}

/* 导航栏样式 */
.header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1em 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 1.3em;
  font-weight: 600;
}

.nav-brand i {
  color: #42f245;
  background: white;
  padding: 0.5em;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.nav-stats {
  display: flex;
  gap: 1.5em;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5em 1em;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item i {
  color: #42f245;
}

/* 主标题区域 */
.hero-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  height: 180px;
}

.hero-content {
  flex: 1;
}

.main-title {
  font-size: 3em;
  margin-bottom: 0.1em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
}

.title-text {
  background: linear-gradient(45deg, #fff, #e8f5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-weight: 700;
}

.title-decoration {
  display: flex;
  gap: 0.3em;
}

.title-decoration i {
  color: #FFD700;
  font-size: 0.5em;
  animation: bounce 2s infinite;
}

.title-decoration i:nth-child(2) {
  animation-delay: 0.3s;
  color: #FF6B6B;
}

.title-decoration i:nth-child(3) {
  animation-delay: 0.6s;
}

.subtitle {
  font-size: 1.3em;
  margin-bottom: 1em;
  opacity: 0.9;
  font-weight: 300;
}

.title-features {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
}

.feature-tag {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.5em 1em;
  border-radius: 20px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.feature-tag:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.feature-tag i {
  color: #42f245;
}

/* 装饰性元素 */
.hero-decoration {
  position: relative;
  width: 200px;
  height: 150px;
}

.floating-icon {
  position: absolute;
  font-size: 2em;
  color: rgba(255, 255, 255, 0.8);
  animation: float 6s ease-in-out infinite;
}

.animal-icon {
  top: 20px;
  right: 60px;
  animation-delay: 0s;
}

.plant-icon {
  top: 60px;
  right: 20px;
  animation-delay: 2s;
}

.nature-icon {
  top: 100px;
  right: 100px;
  animation-delay: 4s;
}

/* 动画效果 */
@keyframes float {

  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }

  50% {
    transform: translateY(-10px) rotate(5deg);
  }
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-5px);
  }

  60% {
    transform: translateY(-3px);
  }
}

.container {
  max-width: 1200px;
  margin: 2em auto;
  padding: 0 1.5em;
}

.filters-container {
  background: white;
  padding: 1.5em;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 2em;
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  align-items: center;
  justify-content: center;
}

.search-box {
  flex: 1;
  min-width: 250px;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.75em 3em 0.75em 1em;
  border: 2px solid #e0e0e0;
  border-radius: 25px;
  font-size: 1em;
  transition: all 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-btn:hover {
  background: #2E5939;
  transform: translateY(-50%) scale(1.1);
}

.category-filters {
  display: flex;
  gap: 0.5em;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5em 1em;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9em;
}

.filter-btn.active {
  background: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

.filter-btn:hover:not(.active) {
  border-color: #4CAF50;
  color: #4CAF50;
}

/* 收藏页面按钮 */
.favorites-btn {
  background: #FF9800;
  color: white;
  border: none;
  padding: 0.5em 1em;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  transition: all 0.3s ease;
}

.favorites-btn:hover {
  background: #F57C00;
  transform: translateY(-2px);
}

.intro {
  text-align: center;
  margin-bottom: 3rem;
  padding: 0 1em;
}

.intro p {
  font-size: 1.1em;
  max-width: 800px;
  margin: 0 auto;
  color: #555;
}

/* 收藏按钮样式 */
.favorite-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.favorite-btn:hover {
  background: white;
  transform: scale(1.1);
}

.favorite-btn i {
  color: #ccc;
  transition: all 0.3s ease;
}

.favorite-btn.active i {
  color: #FF9800;
}

.favorite-btn.active:hover i {
  color: #F57C00;
}

/* 动植物卡片样式 */
.species-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2em;
  margin-bottom: 3em;
}

.species-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  opacity: 1;
  transform: translateY(0);
  transition: all 0.4s ease;
  position: relative;
}

.species-card.hidden {
  display: none;
}

.species-card.fade-out {
  /*淡出*/
  opacity: 0;
  transform: translateY(20px);
}

.species-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.species-image {
  height: 200px;
  overflow: hidden;
  position: relative;
  background: #f5f5f5;
}

.species-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.species-image .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0e0e0;
  color: #999;
  font-size: 0.9em;
}

.species-card:hover .species-image img {
  transform: scale(1.05);
}

.species-content {
  padding: 1.5em;
}

.species-name {
  font-size: 1.5em;
  margin-bottom: 0.5em;
  color: #2e5939;
}

.scientific-name {
  font-style: italic;
  color: #6c757d;
  margin-bottom: 1em;
  font-size: 0.9em;
}

.species-description {
  color: #444;
  margin-bottom: 1.5em;
  /* 文本内容截断，超出部分隐藏 */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.species-features {
  margin-top: 1em;
}

.species-features li {
  margin-bottom: 0.5em;
  list-style-type: none;
  padding-left: 1.5em;
  position: relative;
}

.species-features li:before {
  content: "·";
  color: #4CAF50;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.category-label {
  display: inline-block;
  padding: 0.3em 0.8em;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 500;
  margin-bottom: 1em;
}

.animal {
  background-color: #e3f2fd;
  color: #1556c0;
}

.plant {
  background-color: #e8f5e9;
  color: #2E7D32;
}

/* 页脚样式优化 */
footer {
  background: linear-gradient(135deg, #2E5939 0%, #4CAF50 50%, #2E5939 100%);
  color: white;
  margin-top: 4em;
  border-top: 4px solid #4CAF50;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5em;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2.5em;
  padding: 1em 0;
}

.footer-section h4 {
  color: #42f245;
  font-size: 1.1em;
  margin-bottom: 1.2em;
  font-weight: 500;
}

.footer-section p {
  line-height: 1.6;
  color: #e0e0e0;
  margin-bottom: 1em;
}

/* 社交链接样式 */
.social-links {
  display: flex;
  gap: 1em;
  margin-top: 1.5em;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.social-links a:hover {
  background: #42f245;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* 联系信息样式 */
.contact-info p {
  display: flex;
  align-items: center;
  margin-bottom: 0.8em;
  color: #e0e0e0;
}

.contact-info i {
  width: 20px;
  margin-right: 10px;
  color: #42f245;
}

/* 底部版权区域 */
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5em 0;
  background: rgba(0, 0, 0, 0.2);
}

.copyright {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1em;
}

.copyright p {
  margin: 0;
  color: #e0e0e0;
  font-size: 0.9em;
  padding: 0 5em;
}

.legal-links {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0 5em;
}

.legal-links a {
  color: #e0e0e0;
  text-decoration: none;
  font-size: 0.9em;
  transition: color 0.3s ease;
}

.legal-links a:hover {
  color: #42f245;
}

.divider {
  color: #e0e0e0;
}

/* 加载动画 */
.loading-spinner {
  display: none;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4CAF50;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 2s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.no-results {
  text-align: center;
  padding: 3em;
  color: #666;
  display: none;
}

.no-results.show {
  display: block;
}

/* 详情页样式 */
.detail-page {
  display: none;
  max-width: 1000px;
  margin: 2em auto;
  padding: 0 1.5em;
}

.detail-header {
  display: flex;
  align-items: center;
  margin-bottom: 2em;
  padding: 1em;
  background: linear-gradient(135deg, #3eb742 0%, #68c980 100%);
  border-radius: 12px;
  color: white;
  box-shadow: 0 6px 20px rgba(46, 89, 57, 0.2);
}

.detail-header h2 {
  margin: 0;
  font-size: 1.5em;
  font-weight: 500;
}

.back-button {
  background: green;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 0.6em 1.2em;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 1.5em;
  font-size: 1em;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.back-button:hover {
  background: rgb(2, 173, 2);
  transform: translateY(-3px);
}

.detail-content {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  position: relative;
  transition: transform 0.3 ease, box-shadow 0.3 ease;
}

/* 详情页收藏按钮 */
.detail-favorite-btn {
  position: absolute;
  top: 25px;
  right: 25px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #FF9800;
  border-radius: 25px;
  padding: 0.7em 1.2em;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.detail-favorite-btn:hover {
  background: white;
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.detail-favorite-btn i {
  color: #FF9800;
  transition: all 0.3s ease;
  font-size: 1.1em;
}

.detail-favorite-btn.active i {
  color: #FF9800;
}

.detail-image {
  height: 400px;
  overflow: hidden;
  background: linear-gradient(135deg, #f5f5f5 0%, #e8f5e9 100%);
  position: relative;
}

.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.detail-image .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e0e0e0;
  color: #999;
  font-size: 1.1em;
}

.detail-info {
  padding: 2.5em;
  position: relative;
}

.detail-name {
  font-size: 2.5em;
  margin-bottom: 0.5em;
  color: #2E5939;
  font-size: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  display: inline-block;
}

.detail-scientific {
  font-style: italic;
  color: #6c757d;
  margin-bottom: 2em;
  font-size: 1.2em;
  text-indent: 0;
}

.detail-section {
  margin-bottom: 2em;
  animation: fadeInUp 0.6s ease-out;
}

.detail-section h3 {
  font-size: 1.4em;
  margin-bottom: 1.2em;
  color: #2E5939;
  border-bottom: 2px solid #4CAF50;
  padding-bottom: 0.5em;
}

.detail-section p {
  margin-bottom: 1em;
  line-height: 1.8;
  color: #555;
  font-size: 1.05em;
  text-indent: 2em;
}

.detail-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2em;
  margin-top: 1.2em;
}

.feature-card {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  padding: 1.5em;
  border-radius: 10px;
  border-left: 5px solid #4CAF50;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: all 0.3 ease;
  position: relative;
  overflow: hidden;
}

.feature-card h4 {
  margin-bottom: 0.5em;
  color: #2E5939;
  font-size: 1.1em;
  font-weight: 600;
}

.feature-card p {
  color: #666;
  line-height: 1.6;
  margin: 0;
  text-indent: 0;
}


/* 收藏页面样式 */
.favorites-page {
  display: none;
  width: 1000px;
  margin: 2em auto;
  padding: 0 1.5em;
}

.favorites-header {
  display: flex;
  align-items: center;
  margin-bottom: 2em;
  gap: 1em;
}

.favorites-count {
  background: #FF9800;
  color: white;
  padding: 0.25em 0.75em;
  border-radius: 15px;
  font-size: 0.9em;
}

.empty-favorites {
  text-align: center;
  padding: 3em;
  color: #666;
}

/* 收藏页面卡片容器布局 */
#favorites-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2em;
  margin-bottom: 3em;
}

/*当只有一个收藏项时的特殊布局 */
#favorites-container.single-item {
  display: flex;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto 3em;
}

#favorites-container.single-item .species-card {
  max-width: 400px;
  width: 100%;
  flex-shrink: 0;
  /* 防止卡片被压缩 */
}

/* 确保图片在单项目情况下正常显示 */
#favorites-container.single-item .species-image {
  height: 250px;
}

#favorites-container.single-item .species-image img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* 详情页收藏按钮 */
.detail-favorite-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 25px;
  padding: 0.5rem 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.detail-favorite-btn:hover {
  background: white;
  transform: scale(1.05);
}

.detail-favorite-btn i {
  color: #ccc;
  transition: all 0.3s ease;
}

.detail-favorite-btn.active i {
  color: #FF9800;
}

/* 参考资料样式 */
.references-list {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1.5em;
  border-left: 4px solid #4CAF50;
}

.reference-item {
  margin-bottom: 0.8em;
  padding-left: 1.5em;
  position: relative;
  line-height: 1.5;
  color: #555;
  font-size: 1.05em;
}

/* 为参考资料部分添加计数器 */
.detail-section:last-child {
  counter-reset: reference;
}

.reference-item:before {
  content: counter(reference) "、";
  counter-increment: reference;
  position: absolute;
  left: 0;
  color: #4CAF50;
  font-weight: 500;
}

.reference-item:last-child {
  margin-bottom: 0;
  /* 最后一项取消底部边距 */
}

/* 无参考资料时的提示样式 */
.no-references {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 1em;
  background: #f5f5f5;
  border-radius: 4px;
  margin: 0;
}